using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace VSSDKAssist.Recipes.Common.CustomPages
{
	public partial class InfoForm : Form
	{
		private const int Offset = 10;
		private const int HorizontalOffset = 26; // 3 (Left Border) + Offset + image + Offset + 3 (Right Border)
		private const int VerticalOffset = 76; // 20 (Upper Border) + Offset + image + Offset + 23 (Button Close Height) + Offset +  3 (Bottom Border)

		/// <summary>
		/// Initializes a new instance of the <see cref="InfoForm"/> class.
		/// </summary>
		/// <param name="bitmap">The bitmap.</param>
		public InfoForm(Bitmap bitmap)
		{
			InitializeComponent(); 

			this.pctInfo.Height = bitmap.Height;
			this.pctInfo.Width = bitmap.Width;

			this.Height = bitmap.Height + VerticalOffset;
			this.Width = bitmap.Width + HorizontalOffset;

			this.pctInfo.Location = new Point(Offset, Offset);
			this.pctInfo.Image = Image.FromHbitmap(bitmap.GetHbitmap());
		}

		private void btnClose_Click(object sender, EventArgs e)
		{
			Close();
		}
	}
}